//这是页面App的程序配置
const _host = {
  testHost: "http://10.106.4.35/",//测试地址
  onlineHost: "https://baidu.com" //线上地址
}
const _urlObject = {
  getName: '/data/getName.json',
  deleteName: '/data/deleteName.json'
}

const config = {
  api: _urlObject,
  host: host("host") || _host.testHost,
  debug: host("debug")
}



/**
 * [host description]
 * @param  {[type]} stringName [description]
 * @return {[type]}            [description]
 */
function host(stringName) {
  if (process.env.NODE_ENV === 'production')
    switch (stringName) {
      case "host":
        return JSON.stringify(_host.onlineHost);
        break;
      case "debug":
        return JSON.stringify(false);
        break;
    }
  else if (process.env.NODE_ENV === 'dev') {
    switch (stringName) {
      case "host":
        return JSON.stringify(_host.testHost);
        break;
      case "debug":
        return JSON.stringify(true);
        break;
    }
  }
}

module.exports = config;
